﻿@model Entities.Person
@{
    ViewBag.Title = "PersonMeasuresList";
}
<h2>
    @ViewBag.PersonName</h2>
<h4>
    Роль: @Model.Role.Title
</h4>
<h4>
    Мероприятия сотудника</h4>
<table>
    <tr>
        <td>
            <b>Название</b>
        </td>
        <td>
            <b>Начать до</b>
        </td>
        <td>
            <b>Завершить до</b>
        </td>
        <td>
            <b>Начато</b>
        </td>
        <td>
            <b>Завершено</b>
        </td>
        <td>
            <b>Ответственный</b>
        </td>
        @if (User.IsInRole("ProjectManager") || Model.Username == User.Identity.Name)
        {
            <td>
                <b>Действия</b>
            </td>
        }
    </tr>
    @foreach (Entities.Measure measure in ViewBag.PersonMeasures)
    {
        <tr>
            <td>
                @Html.ActionLink(measure.Title, "RiskDetails", new { id = measure.ProjectRiskId })
            </td>
            <td>@RMSoftware.Tools.FormatDate(measure.ReqBegDate)
            </td>
            <td>@RMSoftware.Tools.FormatDate(measure.ReqEndDate)
            </td>
            <td>@RMSoftware.Tools.FormatDate(measure.BegDate)
            </td>
            <td>@RMSoftware.Tools.FormatDate(measure.EndDate)
            </td>
            <td>@String.Format("{0} {1}", measure.Person.LastName, measure.Person.FirstName, measure.Person.Position)
            </td>
            @if (User.IsInRole("ProjectManager") || Model.Username == User.Identity.Name)
            {
                <td>
                    @Html.ActionLink("Ознакомиться", "Learn", "Measure", new { id = measure.MeasureId }, null)
                    @Html.ActionLink("Добавить отчет", "UploadReport", "Measure", new { id = measure.MeasureId }, null)
                    @Html.ActionLink("Скачать отчет", "DownloadReport", "Measure", new { measureId = measure.MeasureId }, null)
                    @Html.ActionLink("Удалить", "Delete", "Measure", new { id = measure.MeasureId }, null)
                </td>
            }
        </tr>
    }
</table>
